<?php
$dnes = mktime(0,0,0,date("m"),date("d"),date("Y"));
$pocetTyzdnov = ($dnes - $bodNula) / (7*24*60*60);
$pocetTyzdnov = (int) $pocetTyzdnov;
$pocetTyzdnov ++;
$aktualnyTyzden = $pocetTyzdnov;
$pocetTyzdnov += 5;
if (isset($_GET['tyzden']))
    $_POST['tyzden'] = $_GET['tyzden'];
if (isset($_POST['tyzden'])){
    $tyzden = $_POST['tyzden'];
} else {
    $tyzden = $aktualnyTyzden;
}


echo '<form style="margin: 10px 0; border-bottom: 1px solid gray; padding-bottom: 2px;" action="home.php?akc=4" method="post" id="kalendar">';
$formID = "'kalendar'";
echo '<select name="tyzden" size="1" onchange="submitForm('.$formID.')">';
for ($i=$pocetTyzdnov;$i>0;$i--){
    if (($tyzden==$i))
        echo '<option selected value="'.$i.'">Týždeň od '.date("d/m/Y",($bodNula + ($i-1)*(7*24*60*60))).' do '.date("d/m/Y",($bodNula + ($i-1)*(7*24*60*60) + (6*24*60*60) )).'</option>';
    else
        echo '<option value="'.$i.'">Týždeň od '.date("d/m/Y",($bodNula + ($i-1)*(7*24*60*60))).' do '.date("d/m/Y",($bodNula + ($i-1)*(7*24*60*60) + (6*24*60*60) )).'</option>';
}
echo '</select>';
echo '&nbsp;&nbsp;&nbsp;&nbsp;<span style="padding: 1px 5px; background: yellow">Sviatok</span>';
echo '&nbsp;&nbsp;&nbsp;&nbsp;* <b>Nočných za mesiac, Sviatkov za mesiac, Zvyšný nadčas za rok = počet celých odpracovaných hodín</b>';
echo '</form>';

include("tyzden.php");

//echo zistiPocetSekund('22:00', '06:15') / 60 / 60;
?>
